<!--
* @Description: 角色信息 - 表单
* @Author: DHL
* @Date: 2022-03-30 13:50:53
 * @LastEditors: DHL
 * @LastEditTime: 2022-10-07 21:11:48
-->
<template>
  <tw-dialog
    v-model="visible"
    :title="title"
    :loading="loading"
    width="600px"
    height="400px"
    @close="handleClose"
  >
    <el-form
      ref="dbFormRef"
      :model="dbForm"
      :rules="rules"
      label-width="90px"
      :disabled="action === 'view'"
    >
      <el-form-item label="机构" prop="orgId">
        <!-- <el-input
          v-model="myData.orgName"
          clearable
          placeholder="请选择机构"
          :disabled="true"
        ></el-input> -->

        <el-cascader
          v-model="myData.orgId"
          :options="orgTreeData"
          :props="{ checkStrictly: true, value: 'id', label: 'name', children: 'children' }"
          filterable
          clearable
          placeholder="请选择机构"
          @change="handleChangeOrg"
        />
      </el-form-item>

      <el-form-item label="角色名称" prop="name">
        <el-input v-model="dbForm.name" clearable placeholder="请输入角色名称"></el-input>
      </el-form-item>

      <el-form-item label="角色类型" prop="roleType">
        <el-select v-model="dbForm.roleType" clearable placeholder="请选择角色类型">
          <tw-dic dicKey="ROLE_TYPE"></tw-dic>
        </el-select>
      </el-form-item>

      <el-form-item label="角色状态" prop="status">
        <el-select v-model="dbForm.status" clearable placeholder="请选择角色状态">
          <tw-dic dicKey="ROLE_STATE"></tw-dic>
        </el-select>
      </el-form-item>

      <el-form-item label="顺序" prop="roleSeq">
        <el-input-number v-model="dbForm.roleSeq" clearable placeholder="请输入顺序" />
      </el-form-item>

      <el-form-item label="角色描述" prop="description">
        <el-input v-model="dbForm.description" clearable placeholder="请输入角色描述"></el-input>
      </el-form-item>
    </el-form>

    <template #footer>
      <el-button @click="handleReset(true)">取 消</el-button>
      <el-button v-if="action === 'add'" type="warning" @click="handleSubmit(true)">
        提交并继续
      </el-button>
      <el-button v-if="action !== 'view'" type="primary" @click="handleSubmit(false)">
        提 交
      </el-button>
    </template>
  </tw-dialog>
</template>

<script src="./useForm.ts"></script>

<style scoped lang="scss"></style>
